import java.util.Arrays;
import java.util.Scanner;

public class Test {
    public static void main(String[] args) {
        String str1="abcdef";
        char[] arr=str1.toCharArray();
        System.out.println(Arrays.toString(arr));

    }
    public static void main7(String[] args) {   //大小写的转化
        String s1="HEllo";
        String s2="hello";
        System.out.println(s1.toLowerCase());
        System.out.println(s2.toUpperCase());
    }
    public static void main6(String[] args) {
        String str1="ababcabcdaccad";          //indexOf是从前往后找
        System.out.println(str1.indexOf('c'));
        System.out.println(str1.indexOf('c',6));
        System.out.println(str1.indexOf("abcd"));
        System.out.println(str1.indexOf("abcd",6));
        System.out.println("=================");
        System.out.println(str1.lastIndexOf('a'));
        System.out.println(str1.lastIndexOf('a',8));
        System.out.println(str1.lastIndexOf("abcd",6));
    }
    public static void main5(String[] args) {
        String str1="hellogood";  //查找下标为几的字符
        char ch=str1.charAt(5);
        System.out.println(ch);
    }
    public static void main4(String[] args) {  //不管大小写判断字符串是否相等
        String str1="HELLO";
        String str2="heLlo";
        System.out.println(str1.compareToIgnoreCase(str2));
        System.out.println(str1.equalsIgnoreCase(str2));
    }
    public static void main3(String[] args) {
        String str1="abcd";
        String str2="abcef";
        System.out.println(str1.compareTo(str2));
    }
    public static void main2(String[] args) {
        String str1="hello";
        String str2="hello";
        System.out.println(str1.equals(str2));

    }
    public static void main1(String[] args) {   //判断一个字符串是否为空
        Scanner sc=new Scanner(System.in);
        String str=sc.nextLine();
        System.out.println(str.isEmpty());

    }
}
